package com.sunrise.xdoc.entity.config;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.sunrise.xdoc.entity.AbstractCodeEntity;
import com.sunrise.xdoc.entity.user.User;

/**
 * Phong ban, bo phan trong 1 chi nhanh
 * 
 */
@Entity
@Table(name = "config_group")
@Inheritance(strategy = InheritanceType.JOINED)
public class Group extends AbstractCodeEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	private String name;
	private Organization organization;
	private User groupLeader;

	@Column(name = "name")
	@Length(max = 250)
	@NotBlank
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne
	@JoinColumn(name = "organization_id")
	public Organization getOrganization() {
		return organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}

	@ManyToOne
	@JoinColumn(name = "group_leader_id")
	public User getGroupLeader() {
		return groupLeader;
	}

	public void setGroupLeader(User groupLeader) {
		this.groupLeader = groupLeader;
	}

}
